﻿Public Class frmVentaBoleta
    Dim Listaproducto As New LinkedList(Of Producto)
    Dim listapersonaNatural As New LinkedList(Of PersonaNatural)
    Dim listaempresa As New LinkedList(Of Empresa)

    Public Property ListaProductosTotales As LinkedList(Of Producto)
        Get
            Return Listaproducto
        End Get
        Set(ByVal value As LinkedList(Of Producto))
            Listaproducto = value

        End Set
    End Property
    Public Property ListaclientenaturalTotales As LinkedList(Of PersonaNatural)
        Get
            Return listapersonaNatural
        End Get
        Set(ByVal value As LinkedList(Of PersonaNatural))
            listapersonaNatural = value

        End Set
    End Property
    Public Property ListaempresaTotales As LinkedList(Of Empresa)
        Get
            Return listaempresa
        End Get
        Set(ByVal value As LinkedList(Of Empresa))
            listaempresa = value

        End Set
    End Property
    Private Sub frmVentaBoleta_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load



        'For Each myProducto As Producto In Listaproducto
        '    Me.txtProducto.AutoCompleteCustomSource.Add(myProducto.NombreProducto)
        'Next
        'For Each myclientes As PersonaNatural In listapersonaNatural
        '    Me.txtPersonaNatural.AutoCompleteCustomSource.Add(myclientes.Nombre)
        'Next
        'For Each myEmpresa As Empresa In listaempresa
        '    Me.txtTienda.AutoCompleteCustomSource.Add(myEmpresa.nomEmpresa)

        'Next

        Dim conexion As New Conexion
        conexion.AutoCompletarProducto(Me.txtProducto)


    End Sub

    Private Sub btnAgregarProducto_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAgregarProducto.Click
        Dim item As ListViewItem

        Dim datos() As String
        datos = Split(txtProducto.Text, "cod:")

        

        item = Me.lstProductosVender.Items.Add(New ListViewItem(datos(1)))
        item.SubItems.Add(datos(0))
        item.SubItems.Add(txtCantidad.Text)
        item.SubItems.Add(txtPrecio.Text)
        ' item.SubItems.Add(Split(txtProducto.Text, "cod:").ToString)
        item.SubItems.Add(CType(txtCantidad.Text, Integer) * CType(txtPrecio.Text, Decimal))

       


        txtTotal.Text = CType(txtCantidad.Text, Integer) * CType(txtPrecio.Text, Decimal) + CType(txtTotal.Text, Integer)

        txtProducto.Text = ""
        txtPrecio.Text = ""
        txtCantidad.Text = ""
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        MsgBox("REGISTRO EXITOSO")
    End Sub

    Private Sub txtProducto_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtProducto.TextChanged
       
    End Sub

   
End Class